find_package(PostgreSQL)

if(POSTGRESQL_FOUND)
    FIND_PATH(PQXX_INCLUDE_DIR pqxx/pqxx)
    FIND_LIBRARY(PQXX_LIBRARY NAMES pqxx)

    if(PQXX_INCLUDE_DIR AND PQXX_LIBRARY)
        set(PQXX_INCLUDE_DIRS ${POSTGRESQL_INCLUDE_DIR} ${PQXX_INCLUDE_DIR})
        set(PQXX_LIBRARIES ${PQXX_LIBRARY} ${POSTGRESQL_LIBRARIES})
    endif(PQXX_INCLUDE_DIR AND PQXX_LIBRARY)
endif(POSTGRESQL_FOUND)

INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PQXX DEFAULT_MSG PQXX_INCLUDE_DIRS PQXX_LIBRARIES)
